package com.dd.poetry.ui.launcher

import androidx.lifecycle.ViewModelProvider
import com.alibaba.android.arouter.launcher.ARouter
import com.dd.common.base.BaseActivity
import com.dd.common.router.MAIN_ACTIVITY
import com.dd.poetry.databinding.ActivityLauncherBinding

class LauncherActivity : BaseActivity<ActivityLauncherBinding, LauncherViewModel>() {
    private val _binding get() = binding!!
    private val _viewModel get() = model!!

    override fun getViewBinding(): ActivityLauncherBinding {
        return ActivityLauncherBinding.inflate(layoutInflater)
    }

    override fun getViewModel(): LauncherViewModel {
        return ViewModelProvider(this)[LauncherViewModel::class.java]
    }

    override fun initUI() {
        _viewModel.drawable.observe(this) {
            _binding.image.setImageResource(it)
        }

        _binding.image.setOnClickListener {
            ARouter.getInstance().build(MAIN_ACTIVITY).navigation()
        }

    }
}